package com.voxel.sense.infomsg.activity;

import android.content.Context;
import android.content.Intent;
import android.view.View;

import com.example.com.common.app.BaseActivity;
import com.voxel.sense.infomsg.R;
import cyy.example.com.facotry.share.SPEngine;
import com.voxel.sense.infomsg.view.SwitchButton;
import com.voxel.sense.infomsg.utils.manager.NewMsgTipManager;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * Created by ChenYiYao on 2018/1/2.
 * 消息设置
 */


public class MsgReminderActivity extends BaseActivity implements SwitchButton.OnStateChangedListener {
    @BindView(R.id.sb_voice_model)
    SwitchButton sb_voice_model;
    @BindView(R.id.sb_vibration_model)
    SwitchButton sb_vibration_model;

    public static void show(Context context){
        context.startActivity(new Intent(context,MsgReminderActivity.class));
    }

    @Override
    protected int getContentLayoutId() {
        return R.layout.activity_msg_reminder;
    }

    @Override
    protected void initEven() {
        super.initEven();
        sb_voice_model.setOnStateChangedListener(this);
    }

    @OnClick(R.id.tv_shake)
    void onClick(){
        NewMsgTipManager.getInstance().vibratorTip();
    }

    @Override
    public void toggleToOn(View view) {
        switch (view.getId()){
            case R.id.sb_voice_model:
                SPEngine.getSPEngine().getUserInfo().setVoice(true);
                break;
            case R.id.sb_vibration_model:
                SPEngine.getSPEngine().getUserInfo().setVibration(true);
                break;
        }
    }

    @Override
    public void toggleToOff(View view) {
        switch (view.getId()){
            case R.id.sb_voice_model:
                SPEngine.getSPEngine().getUserInfo().setVoice(false);
                break;
            case R.id.sb_vibration_model:
                SPEngine.getSPEngine().getUserInfo().setVibration(false);
                break;
        }
    }
}
